package com.baiyjk.droolsengine.backser.service.iml;

import java.util.List;

import org.kie.api.cdi.KSession;
import org.kie.api.runtime.KieSession;
import org.kie.internal.command.CommandFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baiyjk.droolsengine.backser.entity.Member;
import com.baiyjk.droolsengine.backser.entity.search.PageItem;
import com.baiyjk.droolsengine.backser.service.MemberService;
import com.baiyjk.droolsengine.web.dao.MemberDao;
@Service
public class MemberServiceIml implements MemberService{
	
	@KSession("defaultKieSession")
	//@KReleaseId( groupId = "com.baiyjk", artifactId = "drools-rules", version = "LATEST")
	private KieSession kSession;
	
	@Autowired
	private MemberDao memberDao;
	@Override
	public List<Member> getPageMember(PageItem page){
		List<Member> memberList=memberDao.getMemberList(page);
		kSession.execute(CommandFactory.newInsertElements(memberList));
		kSession.fireAllRules();
		return memberList;
		
	}
}
